package com.lanqiao.guimei.dao;

import com.lanqiao.guimei.vo.DetailItem;

import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * @author StarsOne
 * @date Create in  2019-8-17 0017 20:03:40
 * @description
 */
public class DetailItemDao extends BaseDao {
    public DetailItem queryByProdNo(String prodNo) {
        try {
            return runner.query("select s.saler_id saler,s.carriage, p.PROD_NAME prodName,p.DESCR descr,s.REAL_PRICE realPrice,p.PRICE price,u.LOGIN_NAME salerName,s.LOCATION location,v.VEN_NAME venName,c.CTGR_NAME ctgrName,st.QUANTITY quantity from PRODUCT p,SALE_PROD s,VENDOR v,STOCK st,GUIMEI_USERS u,CATEGORY c where c.CTGR_ID=p.CTGR_ID and s.SALER_ID =u.USER_ID and p.PROD_NO = s.PROD_NO and p.VEN_ID = v.VEN_ID and st.STK_ID = p.STK_ID and p.prod_no=?", new BeanHandler<>(DetailItem.class), prodNo);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    public static void main(String[] args) {
        System.out.println(new DetailItemDao().queryByProdNo("5481B3ECF0EC416DB67B7776D11A85F8").toString());
    }
}
